1. Technical Field
The present invention relates generally to management of computer memory resources, and in particular, to allocation of virtual memory pages. More particularly, the present invention relates to a system and method for managing page allocation in accordance with page type allocation limits.
2. Description of the Related Art
Virtual memory is a critical feature supported by most modern operating systems in conjunction with memory management hardware. Virtual memory essentially provides an alternate set of memory addresses. Programs use these virtual addresses rather than real addresses to store instructions and data. When called by program threads, the virtual addresses are converted into physical or real memory addresses.
The basic purpose of virtual memory is to enlarge the address space comprising the set of addresses a program can utilize. For example, virtual memory might contain twice as many addresses as main memory. A program using all of virtual memory, therefore, would not be able to fit in main memory all at once. Nevertheless, the computer could execute such a program by copying into real memory those portions of the program needed at any given point during program execution.
To facilitate copying virtual memory into real memory, the operating system divides virtual memory into pages, each of which contains a fixed number of addresses. Each page is stored on a disk until it is needed. When the page is needed, the operating system copies it from disk to main memory, translating the virtual addresses into real memory addresses.
In addition to increasing the effective size of memory, virtual memory substantially improves the efficiency of physical memory utilization for processing environments in which ranges of addresses are allocated per program/thread. Specifically, physical addresses only need to be assigned to those logical addresses that are currently active (i.e. not free). If a program is not using a portion of its assigned address space, no physical addresses need be reserved for these unused logical addresses. As a result, a larger portion of main memory is available for use by other programs which can continue to operate as if they have a large contiguous available address space.
While virtual memory improves the sharing of physical memory among threads, other problems relating to efficient physical memory utilization remain unresolved by conventional virtual memory systems. One such problem relates to page allocation in a virtual memory system that utilizes multiple page types.
In many operating systems, such as IBM's AIX® operating system, the page allocation function is performed by a virtual memory manager which services memory requests from the operating system including memory requests originating from application programs. The virtual memory manager manages the allocation of page frames as well as resolving references to virtual memory pages that are not currently in real memory or do not yet exist. To these ends, the virtual memory manager maintains a “free list” of available page frames and uses a page-replacement algorithm such as Least Recently Used (LRU) to determine which pages that are currently in real memory will have their page frames reassigned to the free list (i.e., swapped out).
The page allocation algorithm used by a virtual memory manager typically accounts for the distinction between page types, i.e. pages that are “persistent” versus those that are “working storage pages.” As the name implies, persistent memory pages, referred to alternatively herein as “file pages,” have permanent storage locations on disk. Data files and executable programs are typically mapped to persistent storage pages. On the other hand, working storage pages are transitory and exist only during their use by a program. Working pages have no permanent disk storage location, and when paged out or “swapped,” they are written to disk paging space.
In order to maintain a desired level of input/output (I/O) performance, most virtual memory managers implement page allocation limits for the respective persistent and working page types. Hard limits may be used, for example, to maintain a specified limit on the amount of real memory page frames to be allocated to file pages and/or the amount to be reserved for working storage pages. A hard limit requires that a page replacement be performed when the specified limit threshold is reached for a requested page type even if memory is otherwise available. Many virtual memory managers utilize so-called soft limits which, like hard limits, assign threshold allocation limits to each respective page type. As the name implies, however, soft limits are not enforced as absolute limits on memory allocation for a specified page type but instead are utilized as a page replacement prioritization policy. Namely, each page type is allowed to exceed its assigned threshold such that page replacement is never required while memory is free for at least one of the page types. Upon exhaustion of available page frames, the soft limits then provide the victim selection criteria for pushing limit violators back down during subsequent page replacements.
Hard limits ensure a specified relative allocation between file and working pages. However, such inflexible limits often result in additional overhead processing required for page swapping and fragmented I/O even when some portion of real memory is free. In the absence of hard limits, or when using soft limits that permit all memory to be utilized regardless of the page type of any given request, memory will be exhausted at high utilization periods when demand exceeds the available free list. Such a condition is undesirable particularly considering the unequal penalties associated with replacement of different page types.
From the foregoing, it can be appreciated that a need exists for an improved virtual memory page allocation method and system that addresses the foregoing problems and other needs unresolved by the prior art.